package cn.com.chengmandian.core.common.enums;

import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.List;

public enum BikeMonitoringImageEnum {
    A("扣押车"),
    B("失联车"),
    L("离线车"),
    C("运维故障车"),
    D("用户故障车"),
    E("运营区外"),
    F("零电车"),
    G("缺电车"),
    K("站点外"),
    H("超48H闲置车"),
    I("闲置车"),
    J("占用车");


    private String name;
    public String getName(){
        return this.name;
    }

    public static String getStrSort(){
        BikeMonitoringImageEnum[] bikeMonitoringImageEnums = values();
        List<String> codes = new ArrayList<>();
        for(BikeMonitoringImageEnum value: bikeMonitoringImageEnums){
            codes.add(value.name());
        }
        return ArrayUtil.join(codes.toArray(), ",");
    }

    public static JSONArray getJsonData(){
        JSONArray jsonArray = new JSONArray();
        for(BikeMonitoringImageEnum value : values()){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("code", value.name());
            jsonObject.put("name", value.getName());
            jsonArray.add(jsonObject);
        }
        return jsonArray;
    }

    BikeMonitoringImageEnum(String name){
        this.name = name;
    }
}
